<?php
/**
* 选课
* @date: 2017年8月1日 下午5:07:41
* @author: hxz
*/
namespace app\admin\controller;

use think\Request;

class StudentCourse extends Admin{
    
    public function changeState($state=null)
    {
        $ids = Request::instance()->param('id/a');
        $id = array_unique($ids);
        $id = is_array($id) ? implode(',',$id) : $id;
        if ( empty($id) ) {
            $this->error('请选择要操作的数据!');
        }
        $map['id'] =   array('in',$id);
        switch ($state){
            case 0:
                $data['pause_num'] = ['exp','pause_num+1'];
                $data['state'] = 0;
                break;
            case 1:
                $data['state'] = 1;
                break;
            default:
                $this->error('参数非法');
        }
        $data['update_time'] = NOW_TIME;
        $this->editRow('student_course', $data, $map);
    }
    
}